#!/usr/bin/env python

from BeautifulSoup import BeautifulSoup
from re import findall

with open('extras/neomessages_unsuccessful_auction.phtml.html', 'r') as f:
  soup = BeautifulSoup(f.read())

table = soup.findAll( 'table', attrs={'border':"0", 'cellpadding':"6"})[0]
for tr in table.findAll('tr'):
  if '<b>Message:</b>' in str(tr):
    message = str(tr.findAll('td')[1].contents).replace('\\n','')

if 'has not been successful, because nobody placed a bid' in message:
  print findall('Auction ID # \d+ \((.+)\), has not', message)
